﻿#region Usings
using System.Collections.Generic;

using BK.Model;
using BK.Repositories.Abstract;
#endregion

namespace BK.BlusinessLogic
{
    public class AccountsBl : IGeneralBl<Account>
    {
        #region Readonly & Static Fields
        private readonly IAccountsRepository _accountsRepository;
        #endregion

        #region C'tors
        public AccountsBl(IAccountsRepository accountsRepository)
        {
            _accountsRepository = accountsRepository;
        }
        #endregion

        #region Instance Methods
        public Account GetBy(int userId, string accountName)
        {
            return _accountsRepository.GetBy(userId, accountName);
        }
        #endregion

        public IEnumerable<Account> GetByUserId(int userId)
        {
            return _accountsRepository.GetBy(userId);
        }

        public Account GetById(int id)
        {
            return _accountsRepository.GetById(id);
        }

        public void Save(Account entity)
        {
            _accountsRepository.Save(entity);
        }

        public void Delete(int id)
        {
            _accountsRepository.Delete(id);
        }
    }
}